Smile lets you run scripts from a script window (colored background), or from a text window (white background). In both cases, there is a standard mechanism to display the result of the execution of the script, and a way of customizing this behavior.
Also, you can choose not to display the result of the execution if running from a text window.
Standard output of a script run from a text window
By pressing the Enter key (in the numeric keypad), you can launch the execution of the current script line (line of cursor location), or of the selected script line(s), in a text window. See Scripts In text windows if you are not familiar with this function.
By default, the result of the execution of a script contained in a text window will be appended to the contents of the window.
Optionally, depending on the preferences settings (see "Preferences" dialog), the result can be prefixed with the double hyphen "--" used in the AppleScript language to "comment out" script lines.
Standard output of a script run from a script window
By pressing the "Run" button (the "start" arrow icon at bottom of script window), you can launch the execution of the "run" (or unnamed) handler of a script window.
By default, the result of the execution of this handler will be appended to the contents of a special window, named "Worksheet".
If the "Worksheet" window is not open, it will be automatically opened to display the result.
Redirecting the output
You can redirect the results to another window. Create a new output window by selecting "Make output window" ("Scripts" menu) or use the keyboard shortcut Command-space bar (-" "). The new output window assumes the same name as the previously active window, with the suffix ".out" appended.
Output windows are petite in size and have narrow borders. They may be positioned and resized for your convenience.
Smile supports the use of multiple output windows, but each output window must be tied to another window.
An output window is a text window. It can be saved by using "Save" and "Save as..." ("File" menu) as any other Smile text window. The resulting saved file is a "TEXT" file and appears as a Smile text icon.
Output windows can be used to display the output (result) from a text window or a script window.
Suspending the output
Running selected script lines contained in a text window is very convenient. The display of the result is sometimes useful, but can also be overwhelming, in particular when the result of the script contains lots of data.
You can prevent the output of a script executed from a text window, by appending a colon (":") at the end of it.
The colon is very useful when variables are used that contain lots of data. This prevents the window (where the result would normally be displayed) from becoming overloaded, with what could be megabytes of unwanted data.
A more recent use of the colon comes from a bug of some versions of AppleScript. There is difficulty in displaying the "null" character (ASCII character for 0). Thus, if some variable is suspected of carrying null characters, it is good practice to prevent AppleScript from trying to display it, by using the colon.
The colon at the end of a line is not part of the AppleScript language, so you cannot use it in a script window, only in text windows. It is a small feature added to the command interpreter of Smile. The colon at the end of a particular script line or block is like a command saying "not verbose". In no case will it work in a script window.
• When -space bar is used to open a new output window, the output window will be the frontmost (active) window. The standard approach may not be convenient if additional entries are to be made to the window that is now the second window back. (You would have to click it to make it active.)
Smile offers an alternative method for opening a new output window. This alternative allows for making a new output window while maintaining the frontmost position of the window you are working in.
- space bar with Control key depressed (-ctrl " ") will open a new output window in the second level back. You should be aware that the new output window (at the second level back) may be obscured by the frontmost window and may not be easily seen.
• The "Make output window" script just sets the "console" property of the active window to some new text window. The application Smile itself has also a "console" property, which is used, for instance, when AppleScript recording is on.